#include "Arduino.h"
#include <PubSubClient.h>
#include <ArduinoJson.h>
#include <string.h>
#include <ESP8266WiFi.h>
#include "Ticker.h";

extern WiFiClient espClient;
extern PubSubClient client;
extern Ticker myTicker;

extern const char* mqtt_server;

//连接mqtt
void reconnect();
//消息回调
void callback(char* topic, byte* payload, unsigned int length);
//连接wifi
void setup_wifi();
//发布注册消息
void sendRegisterMsg();
//订阅主题
void subscribeTopic();
//获取注册消息的jsonString
String getRegisterJsonString();
//根据收到的payload转化成消息String
String getMsgStringByPayload(byte* payload,int length);
//到时间时需要执行的任务
void tickerHandle(); 
//翻转
void flagHandle();
